# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-plasma
pkgname=plasma-mobile
pkgver=6.0.4
pkgrel=0
pkgdesc="Modules providing phone functionality for Plasma"
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://www.plasma-mobile.org/"
license="GPL-2.0-or-later AND LGPL-2.1-or-later"
depends="
	bluez-qt
	breeze-icons
	dbus-x11
	kpipewire
	kquickcharts
	maliit-keyboard
	plasma-activities
	plasma-nano
	plasma-nm
	plasma-pa
	plasma-settings
	plasma-workspace
	qqc2-breeze-style
	"
makedepends="
	extra-cmake-modules
	kauth-dev
	kbookmarks-dev
	kcodecs-dev
	kcompletion-dev
	kconfig-dev
	kconfigwidgets-dev
	kcoreaddons-dev
	kdbusaddons-dev
	kdeclarative-dev
	ki18n-dev
	kio-dev
	kirigami-addons-dev
	kitemviews-dev
	kjobwidgets-dev
	knotifications-dev
	kpackage-dev
	kpeople-dev
	kservice-dev
	kwayland-dev
	kwidgetsaddons-dev
	kwin-dev
	kwindowsystem-dev
	kxmlgui-dev
	libphonenumber-dev
	libplasma-dev
	modemmanager-qt-dev
	networkmanager-qt-dev
	plasma-activities-dev
	plasma-workspace-dev
	qcoro-dev
	qt6-qtdeclarative-dev
	samurai
	solid-dev
	telepathy-qt-dev
	"

provides="plasma-phone-components=$pkgver-r$pkgrel" # For backwards compatibility
replaces="plasma-phone-components" # For backwards compatibility

subpackages="$pkgname-lang"

case "$pkgver" in
	*.90*) _rel=unstable;;
	*) _rel=stable;;
esac
_repo_url="https://invent.kde.org/plasma/plasma-mobile.git"
source="https://download.kde.org/stable/plasma/$pkgver/plasma-mobile-$pkgver.tar.xz
	99-flashlight.rules
	"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	install -Dm644 "$srcdir"/99-flashlight.rules -t "$pkgdir"/usr/lib/udev/rules.d/
}

sha512sums="
179ee8d029311a9e8328dbbce22d33bd3b929082d553931443b5dc6f0ae2dbbc54320a9dea1c23b956b3da4504b74322200402062912cc620b23c4d8cc4f418e  plasma-mobile-6.0.4.tar.xz
4badc25cbb7dc84d6af54cff5f3c09dcc37da86b7e930bdcab6d75f8dd90ef0dd9c8a3837ab696b1f4de9cad82d5e64ddd44904640a92e910a8f45524542be95  99-flashlight.rules
"
